package com.zlp.service;

import com.zlp.dto.UploadResp;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

public interface FileService {


    /**
     * 上传文件
     * @param filePath
     * @param file
     * @date: 2021/3/19 13:21
     * @return: java.lang.String
     */
    String uploadFile(String filePath, MultipartFile file);



    /**
     * 上传文件带进度条
     * @param file
     * @param type
     * @param fileSize
     * @param uploadNo
     * @date: 2021/3/17 18:08
     * @return: com.suiren.pub.api.dto.R<com.suiren.pub.api.dto.UploadResp>
     */
    UploadResp uploadFileProgress(@RequestPart(value = "file") MultipartFile file,
                                     @RequestParam(value = "type") String type,
                                     @RequestParam(value = "fileSize") Long fileSize,
                                     @RequestParam(value = "uploadNo") String uploadNo);


    /**
     * 下载文件
     * @param downUrl
     * @param response
     * @date: 2021/3/19 13:24
     * @return: void
     */
    void downFile(String downUrl, HttpServletResponse response);

    /**
     * 通过文件名下载文件到本地
     *
     * @param objectName    要下载的文件名
     * @param localFileName 本地要创建的文件名
     */
     void downloadFile(String objectName, String localFileName);

    List<String> listFile(String filePath);

    /**
     *  删除文件
     * @param delFileUrl
     * @date: 2021/3/20 12:32
     * @return: void
     */
    void delFile(String delFileUrl);

    ResponseEntity<byte[]> downloadObject(String fileName);
}
